
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<HTML>

<HEAD>
   <TITLE>diff_c</TITLE>
</HEAD>

<BODY style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<A name="TOP"></A>

<table style="text-align: left; margin-left: auto; margin-right: auto; width: 800px;"
 border="0" cellpadding="5" cellspacing="2">
  <tbody>
    <tr>
      <td style="background-color: rgb(153, 153, 153); vertical-align: middle; text-align: center;">
      <div align="right"> 
      <small><small><a href="index.html">Index Page</a></small></small>
      </div>
      <b>diff_c</b> </td>
    </tr>

    <tr>
      <td style="vertical-align: top;">

<small><div align="center">
<A HREF="index.html#A">A</A>&nbsp;
<A HREF="index.html#B">B</A>&nbsp;
<A HREF="index.html#C">C</A>&nbsp;
<A HREF="index.html#D">D</A>&nbsp;
<A HREF="index.html#E">E</A>&nbsp;
<A HREF="index.html#F">F</A>&nbsp;
<A HREF="index.html#G">G</A>&nbsp;
<A HREF="index.html#H">H</A>&nbsp;
<A HREF="index.html#I">I</A>&nbsp;
<A HREF="index.html#J">J</A>&nbsp;
<A HREF="index.html#K">K</A>&nbsp;
<A HREF="index.html#L">L</A>&nbsp;
<A HREF="index.html#M">M</A>&nbsp;
<A HREF="index.html#N">N</A>&nbsp;
<A HREF="index.html#O">O</A>&nbsp;
<A HREF="index.html#P">P</A>&nbsp;
<A HREF="index.html#Q">Q</A>&nbsp;
<A HREF="index.html#R">R</A>&nbsp;
<A HREF="index.html#S">S</A>&nbsp;
<A HREF="index.html#T">T</A>&nbsp;
<A HREF="index.html#U">U</A>&nbsp;
<A HREF="index.html#V">V</A>&nbsp;
<A HREF="index.html#W">W</A>&nbsp;
<A HREF="index.html#X">X</A>&nbsp;
</div></small>
       <br>
       <table style="text-align: left; width: 60%; margin-left: auto; margin-right: auto;"
       border="0" cellspacing="2" cellpadding="2">
        <tbody>
          <tr>
            <td style="width: 50%; text-align: center;">
            <small>
              <a href="#Procedure">Procedure<br></a>
              <a href="#Abstract">Abstract<br></a>
              <a href="#Required_Reading">Required_Reading<br></a>
              <a href="#Keywords">Keywords<br></a>
              <a href="#Brief_I/O">Brief_I/O<br></a>
              <a href="#Detailed_Input">Detailed_Input<br></a>

              </small>
              </td>
              <td style="vertical-align: top; width: 50%; text-align: center;">
              <small>               <a href="#Detailed_Output">Detailed_Output<br></a>
              <a href="#Parameters">Parameters<br></a>
              <a href="#Exceptions">Exceptions<br></a>
              <a href="#Files">Files<br></a>
              <a href="#Particulars">Particulars<br></a>
              <a href="#Examples">Examples<br></a>

              </small>
              </td>
              <td style="vertical-align: top; width: 50%; text-align: center;">
              <small>               <a href="#Restrictions">Restrictions<br></a>
              <a href="#Literature_References">Literature_References<br></a>
              <a href="#Author_and_Institution">Author_and_Institution<br></a>
              <a href="#Version">Version<br></a>
              <a href="#Index_Entries">Index_Entries<br></a>
             </small>
            </td>
          </tr>
        </tbody>
</table>

<h4><a name="Procedure">Procedure</a></h4>
<PRE>
   void diff_c (  SpiceCell   * a,
                  SpiceCell   * b,
                  SpiceCell   * c  ) 

</PRE>
<h4><a name="Abstract">Abstract</a></h4>
<PRE>
 
   Take the difference of two sets of any data type to form a third
   set.
 </PRE>
<h4><a name="Required_Reading">Required_Reading</a></h4>
<PRE>
 
   <a href="../req/sets.html">SETS</a> 
 </PRE>
<h4><a name="Keywords">Keywords</a></h4>
<PRE>
 
   CELLS, SETS 
 

</PRE>
<h4><a name="Brief_I/O">Brief_I/O</a></h4>
<PRE>
   VARIABLE  I/O  DESCRIPTION 
   --------  ---  -------------------------------------------------- 
   a          I   First input set. 
   b          I   Second input set. 
   c          O   Difference of a and b. 
 </PRE>
<h4><a name="Detailed_Input">Detailed_Input</a></h4>
<PRE>
 
   a           is a CSPICE set.  a must be declared as a SpiceCell 
               of data type character, double precision, or integer.

   b           is a CSPICE set, distinct from a.  b must have the 
               same data type as a.
 </PRE>
<h4><a name="Detailed_Output">Detailed_Output</a></h4>
<PRE>
 
   c           is a CSPICE set, distinct from sets a and b, which 
               contains the difference of a and b (that is, all of 
               the elements which are in a but NOT in b).  c must 
               have the same data type as a and b.

               When comparing elements of character sets, this routine
               ignores trailing blanks.  Trailing blanks will be 
               trimmed from the members of the output set c.
</PRE>
<h4><a name="Parameters">Parameters</a></h4>
<PRE>
 
   None. 
 </PRE>
<h4><a name="Exceptions">Exceptions</a></h4>
<PRE>
   1) If the input set arguments don't have identical data types,
      the error SPICE(TYPEMISMATCH) is signaled.

   2) If the difference of the two sets contains more elements than can
       be contained in the output set, the error SPICE(SETEXCESS) is
       signaled.

   3) If the set arguments have character type and the length of the 
      elements of the output set is less than the maximum of the 
      lengths of the elements of the input sets, the error 
      SPICE(ELEMENTSTOOSHORT) is signaled. 

   4) If either of the input arguments may be unordered or contain 
      duplicates, the error SPICE(NOTASET) is signaled.
 </PRE>
<h4><a name="Files">Files</a></h4>
<PRE>
 
   None. 
</PRE>
<h4><a name="Particulars">Particulars</a></h4>
<PRE>
   This is a generic CSPICE set routine; it operates on sets of any
   supported data type.
 
   The difference of two sets contains every element which is 
   in the first set, but NOT in the second. 

         {a,b}      difference  {c,d}     =  {a,b} 
         {a,b,c}                {b,c,d}      {a} 
         {a,b,c,d}              {}           {a,b,c,d} 
         {}                     {a,b,c,d}    {} 
         {}                     {}           {} 

 </PRE>
<h4><a name="Examples">Examples</a></h4>
<PRE>
 
   1) The following code fragment places the difference of the
      character sets planets and asteroids into the character set
      result.


         #include &quot;SpiceUsr.h&quot;
                .
                .
                .
         /.
         Declare the sets with string length NAMLEN and with maximum
         number of elements MAXSIZ.
         ./
         SPICECHAR_CELL ( planets,   MAXSIZ, NAMLEN );
         SPICECHAR_CELL ( asteroids, MAXSIZ, NAMLEN );
         SPICECHAR_CELL ( result,    MAXSIZ, NAMLEN );
                .
                .
                .
         /.
         Compute the difference.
         ./
         <b>diff_c</b> ( &amp;planets, &amp;asteroids, &amp;result );


   2) Repeat example #1, this time using integer sets containing
      ID codes of the bodies of interest.


         #include &quot;SpiceUsr.h&quot;
                .
                .
                .
         /.
         Declare the sets with maximum number of elements MAXSIZ.
         ./
         SPICEINT_CELL ( planets,   MAXSIZ );
         SPICEINT_CELL ( asteroids, MAXSIZ );
         SPICEINT_CELL ( result,    MAXSIZ );
                .
                .
                .
         /.
         Compute the difference.
         ./
         <b>diff_c</b> ( &amp;planets, &amp;asteroids, &amp;result );
</PRE>
<h4><a name="Restrictions">Restrictions</a></h4>
<PRE>
 
   1) The output set must be distinct from both of the input sets. 
      For example, the following calls are invalid. 

         <b>diff_c</b>  ( &amp;current,  &amp;new,      &amp;current );
         <b>diff_c</b>  ( &amp;new,      &amp;current,  &amp;current );

      In each of the examples above, whether or not the subroutine 
      signals an error, the results will almost certainly be wrong. 
      Nearly the same effect can be achieved, however, by placing the 
      result into a temporary set, which is immediately copied back 
      into one of the input sets, as shown below. 

         <b>diff_c</b>  ( &amp;current,  &amp;new,  &amp;temp );
         <a href="copy_c.html">copy_c</a>  ( &amp;temp,     &amp;new         );

 
   2) String comparisons performed by this routine are Fortran-style:
      trailing blanks in the input sets are ignored. This gives
      consistent behavior with CSPICE code generated by the f2c
      translator, as well as with the Fortran SPICE Toolkit.

      Note that this behavior is not identical to that of the ANSI
      C library functions strcmp and strncmp.
</PRE>
<h4><a name="Literature_References">Literature_References</a></h4>
<PRE>
 
   None. 
 </PRE>
<h4><a name="Author_and_Institution">Author_and_Institution</a></h4>
<PRE>
 
   N.J. Bachman    (JPL) 
   C.A. Curzon     (JPL) 
   W.L. Taber      (JPL) 
   I.M. Underwood  (JPL) 
 </PRE>
<h4><a name="Version">Version</a></h4>
<PRE>
 
   -CSPICE Version 1.1.0, 15-FEB-2005 (NJB)

       Bug fix:  loop bound changed from 2 to 3 in loop used
       to free dynamically allocated arrays.

   -CSPICE Version 1.0.0, 08-AUG-2002 (NJB) (CAC) (WLT) (IMU)
</PRE>
<h4><a name="Index_Entries">Index_Entries</a></h4>
<PRE>
 
   difference of two sets 
 </PRE>
<h4>Link to routine diff_c source file <a href='../../../src/cspice/diff_c.c'>diff_c.c</a> </h4>

      </td>
    </tr>
  </tbody>
</table>

   <pre>Wed Jun  9 13:05:21 2010</pre>

</body>
</html>

